import React, { Component } from 'react';
import { cate_list } from "../../../api/index";
import '../../../styles/index/home/Cate.scss'

class Cate extends Component {
  constructor(props) {
    super(props)
    this.state = {
      list: []
    }

  }
  async componentDidMount() {
    var res = await cate_list()
    console.log(res.data);
    this.setState({ list: res.data })
  }
  render() {
    return (
      <div className='cate1'>
        {
          this.state.list.map((item, index) => {
            return (

              <figure className='item1' key={index}>
                <figcaption className='se1'>
                  <img src={item.pic} alt="" />
                </figcaption>
                {item.name}
              </figure>

            )
          })
        }
      </div>
    );
  }
}

export default Cate;